package com.cn.login.controller;

import com.cn.common.pojo.ResultModel;
import com.cn.login.entity.model.User;
import com.cn.login.service.UserServiceS;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "登录信息")
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserServiceS userServiceS;
    @GetMapping("findAll")
    public ResultModel findAll(int limit, int page){
        ResultModel all = userServiceS.findAll(limit,page);
        return all;
    }
    @GetMapping("delete")
    public ResultModel delete(int id){
        ResultModel delete = userServiceS.delete(id);
        return delete;
    }
    @PostMapping("update")
    public ResultModel update(User user){
        ResultModel update = userServiceS.update(user);
        return update;
    }
    @PostMapping("insert")
    public ResultModel insert(User user){
        ResultModel insert = userServiceS.insert(user);
        return insert;
    }
    @PostMapping("enable")
    public ResultModel enable(int id){
        ResultModel enable = userServiceS.enable(id);
        return enable;
    }
    @GetMapping("findById")
    public ResultModel findById(int id){
        ResultModel byId = userServiceS.findById(id);
        return byId;
    }

}
